package com.cjj.thread;

/**
 * @ClassName ThreadStudy_2
 * @Date 2021/06/27 23:45:14
 * @Created by ccc-j
 * @email ccc-ju@outlook.com
 */
public class ThreadStudy_2 {

    public static void main(String[] args) {
        System.out.println("创建线程开始！main");
        // 1.定义一个类，实现Runnable接口，重写run方法
        CreateRunnable createRunnable = new CreateRunnable();
        // 2.实现Runnable方法时候与继承Thread的区别
        Thread thread = new Thread(createRunnable);
        thread.start();
        System.out.println("创建线程结束！main");
        for(int i = 0; i < 100; i++){
            System.out.println("main() i: " + i);
        }
    }

}

class CreateRunnable implements Runnable{
    @Override
    public void run() {
        for(int i = 0; i < 100; i++){
            System.out.println("run() i: " + i);
        }
    }
}
